package com.wfuhui.modules.store.api;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wfuhui.common.utils.R;
import com.wfuhui.modules.store.entity.CooperateEntity;
import com.wfuhui.modules.store.service.CooperateService;

@RestController
@RequestMapping("/api/cooperate")
public class ApiCooperateController {

	@Autowired
	private CooperateService cooperateService;
	
    
    @PostMapping("apply")
    public R apply(@RequestBody CooperateEntity cooperate, @RequestAttribute("userId") Long userId) {
    	cooperate.setCreateTime(new Date());
    	cooperate.setUserId(userId);
    	cooperateService.save(cooperate);
    	return R.ok();
    }
}
